package DPT_83;

import LCommon.ListNode;

public class Solution {

	public ListNode deleteDuplicates(ListNode head) {

		ListNode dummy = new ListNode(-1);
		dummy.next = head;
		ListNode p1 = dummy, p2 = head;
		if (p1.next==null) {
			return null;
		}
		while (p2.next != null) {
			if (p1.next.val == p2.next.val) {
				p1.next = p2.next;
				p2=p2.next;

			}else {
				p1 = p1.next;
				p2 = p2.next;
			}
			

		}

		return dummy.next;
	}

}
